import { SecondCareerRuneSubTipsBase } from "./SecondCareerRuneSubTipsBase";
import { ItemData } from "../../../../resource/info/ItemData";
import { ToolTipUtil } from "../util/ToolTipUtil";
import { RuneUtil } from "../../../skill/rune/RuneUtil";
import { GlobalStyle } from "../../../../../common/global/GlobalStyle";
import { ObjCreate } from "../../ObjCreate";
import { GTextFiled } from "../../../../../../com/mui/controls/GTextFiled";
//class SecondCareerNormalRuneSubTips
    
    export  class SecondCareerNormalRuneSubTips extends SecondCareerRuneSubTipsBase
    {
        constructor()
        {
            super();
            return;
        }

        public /* override */ updateData(arg1: ItemData): void
        {
            var loc1=null;
            super.updateData(arg1);
            if (!(arg1.itemInfo == null) && !(arg1.itemInfo.item == null)) 
            {
                loc1 = ToolTipUtil.getItemDescText(arg1);
                this._txtDesc.htmlText = RuneUtil.getRuneItemDesc(arg1);
                if (this._txtDesc.text.length <= 20) 
                {
                    this._txtDesc.height = 50;
                }
                else 
                {
                    this._txtDesc.height = 70;
                }
            }
            return;
        }

        protected /* override */ createDisposedChildrenImpl(): void
        {
            super.createDisposedChildrenImpl();
            var loc1=GlobalStyle.textFormat1;
            loc1.leading = 4;
            this._txtDesc = ObjCreate.createGTextField("", 0, 62, 185, 70, this, loc1);
            this._txtDesc.multiline = true;
            this._txtDesc.wordWrap = true;
            return;
        }

        public getHeight(): number
        {
            var loc2=null;
            var loc1=0;
            while (loc1 < this._txtDesc.numLines) 
            {
                loc2 = this._txtDesc.getLineText(loc1);
                if (loc2 == null || loc2 == "") 
                {
                    break;
                }
                ++loc1;
            }
            if (loc1 <= 0) 
            {
                loc1 = 1;
            }
            return 62 + loc1 * 12 + (loc1 - 1) * 4;
        }

        /* internal */ /* var */_txtDesc: GTextFiled;
    }
